fix(prism): apply syntax highlighting to dynamically created code elements#9
Conversation
|
I deliberately changed I'm also seeing This branch has conflicts that must be resolved in the PR. I had no idea you created a PR - I changed changed my file structure so |
|
I forgot about this issue and the fact that the pre code blocks were not showing syntax highlighting. |
|
I apologize for just noticing your PRs today. I was not getting notifications for this repo - I just changed that. Let me know how you would like to handle your 2 PRs because I do not want to change |
|
@Kernix13 Thank you for the feedback, I will adapt my pull requests to include your update. |
|
Thanks again for taking the time to work on this. I've pushed a larger refactor that restructures parts of the project, so this PR is now out of sync with the current codebase. Because of that, and to keep things aligned with the current architecture, I'm going to close this PR. On the specific change from Thanks again for contributing. |
Summary
Fixes #8 - Prism.js styles not applying on form submit.
When users change secondary languages and click Compare, the syntax highlighting styles were not applied until page reload.
Changes
custom-${lang}tolanguage-${lang}to match Prism.js expected patternPrism.highlightAllUnder(section)increateLiSection()to apply highlighting to dynamically created elementsTechnical Details
The fix addresses two issues:
language-xxxx, notcustom-xxxxBy using
Prism.highlightAllUnder(section)withincreateLiSection(), highlighting is applied efficiently to newly created elements only, improving performance.Closes #8